[@@replace]

open override fun [@@replace](string: String, replaceValue: String): String(source)

Replaces text in a string, using this regular expression.

MDN Reference

Parameters

string

A String object or string literal whose contents matching against this regular expression will be replaced

replaceValue

A String object or string literal containing the text to replace for every successful match of this regular expression.


open override fun [@@replace](string: String, replacer: (substring: String) -> String): String(source)

Replaces text in a string, using this regular expression.

MDN Reference

Parameters

string

A String object or string literal whose contents matching against this regular expression will be replaced

replacer

A function that returns the replacement text.